package me.huangxiang.data_structure_and_algorithm.search;

import me.huangxiang.data_structure_and_algorithm.common.IntegerArrayLoader;
import me.huangxiang.data_structure_and_algorithm.sort.QuickSort;

import java.io.IOException;

public class BinSearchApp {
    public static void main(String[] args) throws IOException {
        int[] a = IntegerArrayLoader.loadInteger();
        QuickSort.quickSortV1(a, 0, a.length - 1);
        int pos = BinSearch.binSearchNoRecursion(a, 34);
        System.out.println("Pos: " + pos);
        System.out.println(a[pos]);
        System.out.println("It has been done " + BinSearch.compareCount);

        pos = BinSearch.binSearchRecursion(a, 34, 0, a.length - 1);
        System.out.println("Pos " + pos);
        System.out.println(a[pos]);

        pos = BinSearch.enhancedBinSearch(a, 34);
        System.out.println("Pos " + pos);
        System.out.println(a[pos]);
        System.out.println("It has been done " + BinSearch.compareCount);
    }
}
